]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ScreenShield: listen to login managers to unlock the session
authorGiovanni Campagna <gcampagna@src.gnome.org>
Fri, 17 Aug 2012 12:24:17 +0000 (14:24 +0200)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Fri, 17 Aug 2012 17:10:27 +0000 (19:10 +0200)
Handle locking and unlocking from outside. This fixes coming
back from fast user switching.

https://bugzilla.gnome.org/show_bug.cgi?id=682096

js/ui/screenShield.js

index c4a23b6e9070e2a0dabebe5ad6b19ecaaf4a0782..0fb410781e14d8c43b8ca85a74a732901a2096a6 100644 (file)
@@ -8,11 +8,13 @@ const Meta = imports.gi.Meta;
 const Signals = imports.signals;
 const St = imports.gi.St;
 
+const ConsoleKit = imports.misc.consoleKit;
 const GnomeSession = imports.misc.gnomeSession;
 const Layout = imports.ui.layout;
 const Lightbox = imports.ui.lightbox;
 const Main = imports.ui.main;
 const MessageTray = imports.ui.messageTray;
+const Systemd = imports.misc.systemd;
 const Tweener = imports.ui.tweener;
 
 const SCREENSAVER_SCHEMA = 'org.gnome.desktop.screensaver';
@@ -340,6 +342,16 @@ const ScreenShield = new Lang.Class({
             this._onStatusChanged(status);
         }));
 
+        if (Systemd.haveSystemd()) {
+            this._systemdProxy = new Systemd.SystemdLoginSession(GLib.getenv('XDG_SESSION_ID'));
+            this._systemdProxy.connectSignal('Lock', Lang.bind(this, function() { this.lock(false); }));
+            this._systemdProxy.connectSignal('Unlock', Lang.bind(this, function() { this.unlock(); }));
+        } else {
+            this._consoleKitProxy = new ConsoleKit.ConsoleKitManager();
+            this._consoleKitProxy.ckSession.connectSignal('Lock', Lang.bind(this, function() { this.lock(false); }));
+            this._consoleKitProxy.ckSession.connectSignal('Unlock', Lang.bind(this, function() { this.unlock(); }));
+        }
+
         this._settings = new Gio.Settings({ schema: SCREENSAVER_SCHEMA });
 
         this._isModal = false;